var mongodb = require('mongodb');
var config  = require(require('fs').existsSync('../config.js') ? '../config.js' : './config.js');
var db = require('./common/db.js');

db.loadDB(function(db) {
    //db.createCollection('gateway', {}, function(err, result){
        var gateway = db.collection('gateway');
        gateway.insert({_id:'_userid', 'ai':100000000+config.ServerId*100000}, 
            function(err, result){
                db.close();
            });
    //});
}, 2, config.MongodbHost, config.MongodbPort, config.MongodbName);

console.log('Creating...   Please wait...');

setTimeout(function(){
    process.exit(0);
},3000);
